package com.wang.learn.sharding.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wang.learn.sharding.entity.A38;
import com.wang.learn.sharding.mapper.A38Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class A38Controller {

    @Autowired
    private A38Mapper a38Mapper;

    @RequestMapping("/a38Add")
    public void a38Add(){
        A38 a38 = new A38();
        a38.setA3801("a3801");
        a38.setA3802("a3802");
        a38Mapper.insert(a38);
    }

    @RequestMapping("/a38FindByPage")
    public IPage<A38> a38FindByPage(){
        IPage<A38> userPage = new Page<A38>(0, 1);//参数一是当前页，参数二是每页个数
        IPage<A38> a31IPage = a38Mapper.selectPage(userPage, new QueryWrapper<A38>());
        return a31IPage;
    }

}